package com.ougy.reshop.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToOne;

import org.hibernate.annotations.Type;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Store;

@Entity
public class User {
	private int id;
	private String username;
	private String password;
	private byte validated;
	private byte gender;
	private Accessory photo;
	private byte country;
	private int state;
	private int city;
	private String address;
	private short friend;
	private byte fgrade;
	private int balance;
	private String draw;
	private int exchange;
	private int good;
	private int bad;
	private Date createTime;
	private Date lastTime;
	private byte tip;
	private Date updateTime;
	private byte readed;
	private String email;
	private Shop shop;
	private String trueName;
	private String identityCard;
	private int userType;
	@Column(columnDefinition="int default 0")
	public int getUserType() {
		return userType;
	}

	public void setUserType(int userType) {
		this.userType = userType;
	}

	public String getTrueName() {
		return trueName;
	}

	public void setTrueName(String trueName) {
		this.trueName = trueName;
	}

	public String getIdentityCard() {
		return identityCard;
	}

	public void setIdentityCard(String identityCard) {
		this.identityCard = identityCard;
	}

	@OneToOne
	public Shop getShop() {
		return shop;
	}

	public void setShop(Shop shop) {
		this.shop = shop;
	}

	public String getAddress() {
		return address;
	}


	@Column(columnDefinition="int default 0")
	public int getBad() {
		return bad;
	}
	@Column(nullable=true)
	public int getBalance() {
		return balance;
	}

	public int getCity() {
		return city;
	}

	public byte getCountry() {
		return country;
	}

	public Date getCreateTime() {
		return createTime;
	}

	@Column(nullable=true,columnDefinition = "text")
	public String getDraw() {
		return draw;
	}
	@Column(nullable=true)
	public int getExchange() {
		return exchange;
	}
	
	@Column(nullable=true)
	public byte getFgrade() {
		return fgrade;
	}
	@Column(nullable=true)
	public short getFriend() {
		return friend;
	}
	@Column(nullable=true)
	public byte getGender() {
		return gender;
	}

	@Column(columnDefinition="int default 0")
	public int getGood() {
		return good;
	}

	@Id
	@GeneratedValue
	public int getId() {
		return id;
	}

	public Date getLastTime() {
		return lastTime;
	}

	@Column(length=32,nullable=false)
	public String getPassword() {
		return password;
	}
	
	@Column(nullable=true)
	public byte getReaded() {
		return readed;
	}
	@Column(columnDefinition="int default 0")
	public int getState() {
		return state;
	}
	@Column(nullable=true)
	public byte getTip() {
		return tip;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	@Column(length = 20,unique=true,nullable=false)
	@Field(index=Index.UN_TOKENIZED,store=Store.YES)
	public String getUsername() {
		return username;
	}
	
	@Column(columnDefinition="int default 1")
	public byte getValidated() {
		return validated;
	}

	public void setAddress(String address) {
		this.address = address;
	}


	public void setBad(int bad) {
		this.bad = bad;
	}

	public void setBalance(int balance) {
		this.balance = balance;
	}

	public void setCity(int city) {
		this.city = city;
	}

	public void setCountry(byte country) {
		this.country = country;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public void setDraw(String draw) {
		this.draw = draw;
	}

	public void setExchange(int exchange) {
		this.exchange = exchange;
	}

	public void setFgrade(byte fgrade) {
		this.fgrade = fgrade;
	}

	public void setFriend(short friend) {
		this.friend = friend;
	}

	public void setGender(byte gender) {
		this.gender = gender;
	}

	public void setGood(int good) {
		this.good = good;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setLastTime(Date lastTime) {
		this.lastTime = lastTime;
	}
	public void setPassword(String password) {
		this.password = password;
	}

	public void setReaded(byte readed) {
		this.readed = readed;
	}

	public void setState(int state) {
		this.state = state;
	}

	public void setTip(byte tip) {
		this.tip = tip;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public void setValidated(byte validated) {
		this.validated = validated;
	}
	@OneToOne
	public Accessory getPhoto() {
		return photo;
	}

	public void setPhoto(Accessory photo) {
		this.photo = photo;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

}
